import { ref } from 'vue'

export default  function useBaseConfig(){
	const barTop = ref(0)
	const barHeight = ref(0)
	const placeHolderHeight = ref(0)
	
	const getSystemInfoSync = uni.getSystemInfoSync()
	barTop.value = getSystemInfoSync.statusBarHeight || 0;
	const menuButtonInfo = uni.getMenuButtonBoundingClientRect(); // 获取胶囊按钮位置信息
	barHeight.value = menuButtonInfo.height + (menuButtonInfo.top - barTop.value) * 2; // 获取导航栏高度
	placeHolderHeight.value = barHeight.value + barTop.value + 4; // +5是因为ui设计稿的高度比微信默认大概加了5像素
	
	uni.setStorageSync('useBaseConfig',{
		menuButtonInfo,
		customNavBar: {
			barHeight:barHeight.value,
			placeHolderHeight:placeHolderHeight.value,
			barTop:barTop.value
		},
		systemInfo: getSystemInfoSync
	})
	
}